<%@page import="java.util.Date"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
 <c:set var="now" value="<%=new Date() %>" />  
  <br />
 <fmt:formatDate type="time" value="${now}" /> 
 <br />
 <fmt:formatDate type="date" value="${now}" />  
 <br /> 
 <fmt:formatDate type="both" value="${now}" />  
 <br /> 
 <fmt:formatDate type="both" dateStyle="short" timeStyle="short" 
  value="${now}" />  
  <br />
 <fmt:formatDate type="both" dateStyle="medium" timeStyle="medium" 
  value="${now}" />  
  <br />
 <fmt:formatDate type="both" dateStyle="long" timeStyle="long" 
  value="${now}" />  
  <br />
 <fmt:formatDate pattern="yyyy-MM-dd" value="${now}" /> 
</body>
</html>